package com.compunit.composite.core.interfaces;

import java.io.IOException;
import java.net.URISyntaxException;
import java.net.URL;

import javax.naming.OperationNotSupportedException;

import com.compunit.composite.core.interfaces.cx.ICxExporter;

/**
 * <code>IComposer</code> defines the interface that is
 * responsible for composing multiple components into a
 * single component unit.
 * <p>
 * <code>IComposer</code> does not support the parent-
 * defined <code>export</code> methods. Instead the
 * <code>compose</code> method should be used to compose
 * the components.
 *
 * @author Yi Wang (Neakor)
 * @version Creation date: 11-21-2009 22:18 EST
 * @version Modified date: 11-21-2009 22:22 EST
 */
public interface IComposer extends ICxExporter {

	/**
	 * Compose the cached components and export the
	 * corresponding class, recourse and cx files.
	 * @param directory The <code>URL</code> representing
	 * the destination file directory.
	 * @throws URISyntaxException If given URL is invalid.
	 * @throws IOException If file handling failed.
	 * @throws OperationNotSupportedException If this export
	 * operation is not supported by the implementation.
	 */
	public void compose(final URL directory) throws URISyntaxException, IOException, OperationNotSupportedException;
	
	/**
	 * Add the given component to be composed with other
	 * cached components.
	 * @param directory The <code>URL</code> representing
	 * the directory where the component files reside.
	 * @param name The <code>String</code> name of the
	 * component.
	 * @throws IOException If processing component failed.
	 * @throws ClassNotFoundException If loading of classes
	 * of the component failed.
	 * @throws URISyntaxException If given URL is invalid.
	 */
	public void addComponent(final URL directory, final String name) throws IOException, ClassNotFoundException, URISyntaxException;
}
